﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace MS.INV.Systems
{
    public partial class SetOwner : DevExpress.XtraEditors.XtraForm
    {
        public bool IsChange { get; set; }

        public SetOwner()
        {
            InitializeComponent();
        }

        private void SetOwner_Load(object sender, EventArgs e)
        {
            txtName.Text = Options.TenQuan;
            txtAdd.Text = Options.DiaChi;
            txtPhone.Text = Options.DienThoai;
        }

        private void btOk_Click(object sender, EventArgs e)
        {
            try
            {
                using (ZZ_System sys = new ZZ_System())
                {
                    sys.ArgUpdate(3, "Agr1", txtName.Text);
                    sys.ArgUpdate(3, "Agr2", txtAdd.Text);
                    sys.ArgUpdate(3, "Agr3", txtPhone.Text);
                }
                Options.TenQuan = txtName.Text;
                Options.DiaChi = txtAdd.Text;
                Options.DienThoai = txtPhone.Text;
                IsChange = true;

                MessageBox.Show("Cập nhật thành công.");
            }
            catch (Exception ex)
            {
                Lib.Bases.SysError.RaiseError(ex, this.Name, "Onload");
            }
        }

        private void btCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}